<?php
include_once("httpsqs_client.php");
$httpsqs = new httpsqs($httpsqs_host, $httpsqs_port, $httpsqs_auth, $httpsqs_charset);

/*
1. PUT text message into a queue.
   If PUT successful, return boolean: true
   If an error occurs, return boolean: false
*/
$result = $httpsqs->put($queue_name, $queue_data);

/*
2. GET text message from a queue.
   Return the queue contents.
   If there is no unread queue message, return text: HTTPSQS_GET_END
   If an error occurs, return boolean: false.
*/
$result = $httpsqs->get($queue_name); 

/*
3. GET text message and pos from a queue.
   Return example: array("pos" => 7, "data" => "text message")
   If there is no unread queue message, return: array("pos" => 0, "data" => "HTTPSQS_GET_END")
   If an error occurs, return boolean: false.
*/
$result = $httpsqs->gets($queue_name);

/*
4. View queue status
*/
$result = $httpsqs->status($queue_name); 

/*
5. View queue status in json
   Return example: {"name":"queue_name","maxqueue":5000000,"putpos":130,"putlap":1,"getpos":120,"getlap":1,"unread":10}
*/
$result = $httpsqs->status_json($queue_name);

/*
6. View the contents of the specified queue pos (id).
   Return the contents of the specified queue pos.
*/
$result = $httpsqs->view($queue_name, $queue_pos);

/*
7. Reset the queue.
   If reset successful, return boolean: true
   If an error occurs, return boolean: false
*/
$result = $httpsqs->reset($queue_name);

/*
8. Change the maximum queue length of per-queue.
   If change the maximum queue length successful, return boolean: true
   If it be cancelled, return boolean: false
*/
$result = $httpsqs->maxqueue($queue_name, $num);

/*
9. Change the interval to sync updated contents to the disk.
   If change the interval successful, return boolean: true
   If it be cancelled, return boolean: false
*/
$result = $httpsqs->synctime($num);
?>